package com.bankwel.j3d.model;

import java.awt.Graphics2D;

import org.apache.log4j.Logger;

import com.bankwel.j3d.core.J3dMatrix;
import com.bankwel.j3d.core.J3dChannel;

public abstract class Object3d {

	private J3dMatrix j3d;

	protected Logger logger = Logger.getLogger(this.getClass());

	public Object3d() {
		j3d = J3dChannel.unit();
	}

	public Object3d(J3dMatrix j3d) {
		if (j3d == null)
			j3d = J3dChannel.unit();
		this.j3d = j3d;
		logger.info("3d object initialized successfully with world matrix:" + j3d);
	}

	public J3dMatrix getJ3d() {
		return j3d;
	}

	public void setJ3d(J3dMatrix j3d) {
		this.j3d = j3d;
	}

	public abstract void draw(Graphics2D g2d);

	public void excute(J3dMatrix action) {
		j3d.join(action);
		logger.info("The object's world matrix changed to:" + j3d + "by" + action);
	}
}
